package com.wectrls.service.impl;

import com.wectrls.config.exceptiom.CommonException;
import com.wectrls.entity.UserGroup;
import com.wectrls.mapper.UserGroupMapper;
import com.wectrls.service.UserGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

/**
 * @author chenjian
 * @Package
 * @Description:
 * @date 2019-10-31 13:38
 */
@Service
@Transactional
public class UserGroupServiceImpl implements UserGroupService {

    @Autowired
    private UserGroupMapper userGroupMapper;

    @Override
    public UserGroup findById(String userGroupId) {
        Optional<UserGroup> optional = userGroupMapper.findById(userGroupId);
        if (optional.isPresent()) {
            return optional.get();
        }
        throw new CommonException("无资源", 4004);
    }
}
